<?php

/*
 * This is for send sms to family.
 */

$message='Name of Dr: '.$_POST['name_doctor'].'Name structure: '.$_POST['name_struc'].'Structure: '.$_POST['name_tell'];
    
    if(isset($_POST['rl1']))
    {
        $num1=$_POST['rl1'];
        $url='http://gate.sms.it/gate-http';
      $myvars = "USER=salusbank&CODE=C_nOt.Q0vNAPk&TEXT=".$message."&DEST=".$num1;
        $ch = curl_init( $url );
        curl_setopt( $ch, CURLOPT_POST, 1);
        curl_setopt( $ch, CURLOPT_POSTFIELDS, $myvars);
        curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt( $ch, CURLOPT_HEADER, 0);
        curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);
        $content=curl_exec( $ch ) or die(header("Location:../view/sms_to_family?e=sending failed")) ;                
    }

 echo $content;

    if(isset($_POST['rl2']))
    {
        $num2=$_POST['rl2'];
         $url='http://gate.sms.it/gate-http';
      $myvars = "USER=salusbank&CODE=C_nOt.Q0vNAPk&TEXT=".$message."&DEST=".$num2;
        $ch = curl_init( $url );
        curl_setopt( $ch, CURLOPT_POST, 1);
        curl_setopt( $ch, CURLOPT_POSTFIELDS, $myvars);
        curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt( $ch, CURLOPT_HEADER, 0);
        curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);
        $content=curl_exec( $ch ) or die(header("Location:../view/sms_to_family?e=sending failed")) ;
    }

     if(isset($_POST['rl3']))
    {
        $num3=$_POST['rl3'];
         $url='http://gate.sms.it/gate-http';
      $myvars = "USER=salusbank&CODE=C_nOt.Q0vNAPk&TEXT=".$message."&DEST=".$num3;
        $ch = curl_init( $url );
        curl_setopt( $ch, CURLOPT_POST, 1);
        curl_setopt( $ch, CURLOPT_POSTFIELDS, $myvars);
        curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt( $ch, CURLOPT_HEADER, 0);
        curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);
        $content=curl_exec( $ch ) or die(header("Location:../view/sms_to_family?e=sending failed")) ; 
    }    
    

   header("Location:../view/sms_to_family?s=message sent.");
   
?>